import pandas as pd
import joblib

# 加载已保存的模型
model = joblib.load('../model/mlp_breast_cancer_model.pkl')

# 假设你需要预测的新病人特征如下，请严格按照训练时的顺序和列名输入
new_sample = pd.DataFrame({
    'radius_mean': [14.0],
    'texture_mean': [20.0],
    'perimeter_mean': [90.0],
    'area_mean': [600.0],
    'smoothness_mean': [0.1],
    'compactness_mean': [0.12],
    'concavity_mean': [0.15],
    'concave points_mean': [0.06],
    'symmetry_mean': [0.2],
    'radius_se': [0.4],
    'perimeter_se': [3.0],
    'area_se': [40.0],
    'compactness_se': [0.03],
    'concavity_se': [0.05],
    'concave points_se': [0.02],
    'fractal_dimension_se': [0.003],
    'radius_worst': [15.5],
    'texture_worst': [28.0],
    'perimeter_worst': [100.0],
    'area_worst': [700.0],
    'smoothness_worst': [0.14],
    'compactness_worst': [0.2],
    'concavity_worst': [0.2],
    'concave points_worst': [0.08],
    'symmetry_worst': [0.3],
    'fractal_dimension_worst': [0.08]
}, columns=[
    'radius_mean','texture_mean','perimeter_mean','area_mean','smoothness_mean',
    'compactness_mean','concavity_mean','concave points_mean','symmetry_mean',
    'radius_se','perimeter_se','area_se','compactness_se','concavity_se','concave points_se',
    'fractal_dimension_se','radius_worst','texture_worst','perimeter_worst','area_worst',
    'smoothness_worst','compactness_worst','concavity_worst','concave points_worst',
    'symmetry_worst','fractal_dimension_worst'
])

# 预测类别
pred_label = model.predict(new_sample)[0]

proba = model.predict_proba(new_sample)[0]
print(f"新病人预测类别（1=恶性，0=良性）：{pred_label}")
print(f"新病人属于该类别（{pred_label}）的概率：{proba[pred_label]}")